/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package protocol;

import server.ServeOneThread;

/**
 *
 * @author User
 */
public class Protocol {
  ServeOneThread mysrv;
 // private static final Logger log = Logger.getLogger(Protocol.class);
  
  
  
  public String get(String str, ServeOneThread mysrv) throws org.json.simple.parser.ParseException
   {
       String type;
       String rety = str;
       this.mysrv = mysrv;
       
    //   log.info("Start Protocol");
       
//       catch (Exception e) {
//            log.fatal("Game exception", e);
//        }
       
      // log.debug("Protocol str" + str);
       JsonSerializer json = new JsonSerializer();
       json.startGet(str);
       
       type = json.getString("Type");
       
       if (type.equals("Connect"))
       {
         //String name = json.getString("Name");
        // log.debug(name);
         rety = "Connect";
         try {
          // control.execute(rety, name, null, null, null);
         } catch (Exception e)
        {
          //  log.info("test" + e);
        }
       }
       
       if (type.equals("GetList"))
       {
         //String name = json.getString("Name");
        // log.debug(name);
         rety = "GetList";
       }
       
       if (type.equals("Info"))
       {
         //String name = json.getString("Name");
        // log.debug(name);
         rety = "Info";
       }
       
       if (type.equals("Save"))
       {
         //String name = json.getString("Name");
        // log.debug(name);
         rety = "Save";
       }
       
       if (type.equals("Add"))
       {
         //String name = json.getString("Name");
        // log.debug(name);
         rety = "Add";
       }

       return rety;
   }

}
